﻿<!-- _meta 作为公共模版分离出去 -->
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp"/>
	<link rel="Shortcut Icon" href="/admin/imgs/logo.ico"/>
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
	<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
	<title>大会后台</title>
	<style type="text/css">
	</style>

	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
	<script type="text/javascript" src="js/admin.js"></script>
	<script type="text/javascript">
	</script>
</head>
<body>
<section class="Hui-article-box" style="position:relative;top:0;left:0;">
	<nav class="breadcrumb" style="color:#888;">
		<i class="Hui-iconfont">&#xe67f;</i>
		<a href="main.html" class="maincolor">首页</a>
		<span class="c-gray en">&gt;</span>
		前台
		<span class="c-gray en">&gt;</span>
		大会介绍
	</nav>
</section>
<div class="page-container" style="margin:10px 10%;width:50%;position:relative;top:50px;left:0;">
	<div class="row cl" style="margin-bottom:20px;">
		<label class="form-label col-xs-4 col-sm-3">
			超管名称：
		</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="管理员名称" id="uname">
		</div>
	</div>
	<div class="row cl" style="margin-bottom:20px;">
		<label class="form-label col-xs-4 col-sm-3">
			老密码：
		</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" placeholder="原密码" id="pwd">
		</div>
	</div>
	<div class="row cl" style="margin-bottom:20px;">
		<label class="form-label col-xs-4 col-sm-3">
			新密码：
		</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" placeholder="新密码" id="pwd2">
		</div>
	</div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
			<button onClick="save()" class="btn btn-secondary radius" type="button">立即保存</button>
		</div>
	</div>
</div>

<span id="pop"></span>
</body>
</html>


<script type="text/javascript">
	(function(){
		getOne();
	})();
	//获取管理员
	function getOne(){
		var info = getLoginInfo();
		$('#uname')[0].value = info.adminName;
	}
	//保存
	function save(){
		var uname = $('#uname').val();
		var pwd = $('#pwd').val();
		var pwd2 = $('#pwd2').val();
		if (uname=='') { pop({msg:'超管未填写'}); return }
		if (pwd=='') { pop({msg:'原密码未填写'}); return }
		if (pwd2=='') { pop({msg:'新密码未填写'}); return }
		var formData = {
			name: uname, pwd: pwd, pwd2: pwd2,
		};
		$.ajax({
			type: 'post',
			url: domain+'modify',
			data: formData,
			success: function (res) {
				res = JSON.parse(res);
				console.log(res);
				if (res.code!=0) {
					pop({msg:res.msg}); return;
				}
				pop({msg:'成功'});
				var loginInfo = {
					adminid: 1, adminName: uname,
				};
				setLoginInfo({val:loginInfo});
				setTimeout(function(){
					window.location.href = '';
				},1000);
			},
			error: function () {
				console.log('网络错误');
			}
		});
	}
</script>